package com.xd.center.http.builder;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

/**
 * 编码
 */
public interface HttpEncoder {

  Object encode(Object object, MethodMetadata methodMetadata);

  class Default implements HttpEncoder {

    @Override
    public Object encode(Object object, MethodMetadata methodMetadata) {
      return JSON.toJSONString(object, SerializerFeature.WriteNonStringKeyAsString);
    }
  }
}
